<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>admin page</title>
    <script>
        function del() {
            return confirm("delete this record?");
        }
    </script>
</head>
<body>
<h1>admin page</h1>
<a href="add.jsp">Add employee</a>
<hr>
<table border="1">
    <tr>
        <th>ID</th>
        <th>NAME</th>
        <th>AGE</th>
        <th>GENDER</th>
        <th colspan="3">OPERATIONS</th>
    </tr>
    <c:forEach var="employee" items="${sessionScope.employees}">
        <tr>
            <td>${employee.id}</td>
            <td>${employee.name}</td>
            <td>${employee.age}</td>
            <td>${employee.gender}</td>
            <td><a href="/employee?action=findById&id=${employee.id}">EDIT</a></td>
            <td><a href="/employee?action=removeById&id=${employee.id}" onclick="return del()">REMOVE</a></td>
            <td><a href="/employee?action=detail&id=${employee.id}">DETAIL</a></td>
        </tr>
    </c:forEach>
</table>
<hr>
<a href="/employee?action=sign_out">Sign out</a>
</body>
</html>